﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class JiaMi : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (TextBoxCode.Text!="")
        {
            string code = TextBoxCode.Text;
            int nLen = code.Length;
            if (code.Length > 10)
            {
                code.Substring(0, 10);
            }
            
            if(TextBoxJia.Text!="")
            {
                string jiaMi = TextBoxJia.Text;
                System.Text.ASCIIEncoding  encoding=new System.Text.ASCIIEncoding();
                Byte[] bytes = encoding.GetBytes(jiaMi);
                whoBase64 b = new whoBase64();
                Byte[] bytesCode = encoding.GetBytes(code);
                b.SwapKey(bytesCode);
                b.Base64Encoder(bytes);
                string sEn = new string(b.GetEncoded());
                TextBoxJie.Text = sEn;
            }
            else if (TextBoxJie.Text!="")
            {

            }




        }
    }
}
